package com.fjp.heartguard.ui.report.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.fjp.heartguard.R
import com.fjp.heartguard.app.data.bean.ReportsHistory
import com.fjp.heartguard.app.ext.setAdapterAnimation
import com.fjp.heartguard.app.util.SettingUtil


class HistoryReportAdapter(data: ArrayList<ReportsHistory>, var clickItem: (item: ReportsHistory) -> Unit) : BaseQuickAdapter<ReportsHistory, BaseViewHolder>(R.layout.item_history_report, data) {
    init {
        setAdapterAnimation(SettingUtil.getListMode())
    }

    override fun convert(holder: BaseViewHolder, item: ReportsHistory) {
        holder.setText(R.id.titleTv, item.title)
        holder.setText(R.id.nameTv, item.name)
        holder.setText(R.id.timeTv, item.created_at.split(" ")[0])
        holder.setText(R.id.assessorTv, item.user)
        holder.itemView.setOnClickListener {
            clickItem(item)
        }
    }

}


